package com.lkd.feign.fallback;

import com.google.common.collect.Lists;
import com.lkd.feign.OrderService;
import com.lkd.feign.UserService;
import com.lkd.feign.VMService;
import com.lkd.vo.PartnerVO;
import com.lkd.vo.PayVO;
import com.lkd.vo.SkuVO;
import com.lkd.vo.UserVO;
import com.lkd.vo.VmVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
@Slf4j
public class OrderServiceFallbackFactory implements FallbackFactory<OrderService> {
    @Override
    public OrderService create(Throwable throwable) {
        log.error("调用售货机服务失败",throwable);
        return new OrderService() {
            @Override
            public Map<String, String> weixinPay(PayVO payVO) {
                Map<String, String> map = new HashMap();
                map.put("msg","当前网络不畅通，请稍后再试");
                map.put("code","RETURN_FAIL");
                return map;
            }
        };
    }

}
